package com.yunban.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yunban.domain.UpdateDynamic;
import com.yunban.dto.UpdateDynamicResp;
import com.yunban.mapper.UpdateDynamicMapper;
import com.yunban.service.UpdateDynamicService;
import net.lab1024.sa.base.common.util.SmartPageUtil;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UpdateDynamicServiceImpl extends ServiceImpl<UpdateDynamicMapper, UpdateDynamic> implements UpdateDynamicService {

    @Override
    public List<UpdateDynamicResp> updateDynamicList() {
        LambdaQueryWrapper<UpdateDynamic> queryWrapper = new LambdaQueryWrapper<>();
        // 按date排序 降序
        queryWrapper.orderByDesc(UpdateDynamic::getDate);
        return SmartPageUtil.convert(this.list(queryWrapper), UpdateDynamicResp.class);
    }
}
